- /* scfctan.cpp by K.Tsuru */
- // function ID = 9114
- /*****************************************
- SComplex class
- It returns tan(z).
- Let z = x+iy,
- tan(z) = {sin(2*x)+i*sinh(2*y)}/{cos(2*x)+cosh(2*y)}
- 1 - exp(2*i*z)
- =i*-----------------
- 1 + exp(2*i*z)
-
- remake on Aug 14, 1995 (since version 2.30)
- *****************************************/
- #ifndef SN_H
- #include "sn.h"
- #endif
-
- SComplex Ctan(const SComplex& z)
- {
- if(z.IsZero()) return SComplex(0.0);
-
- #if 0 // 31.3 sec
- SDouble den, rr, ri;
- den = Cos(2*z.Real())+Cosh(2*z.Imag());
- den = 1/den;
- rr = Sin(2*z.Real()) * den;
- ri = Sinh(2*z.Imag()) * den;
-
- return SComplex(rr, ri);
- #else // 15.9 sec
- SComplex z2 = 2*MultI(z), ez2 = Cexp(z2), r;
-
- r = (1.0 - ez2)/(1.0 + ez2);
-
- return MultI(r);
- #endif
- }
scfctan.cpp : last modifiled at 2015/08/15 16:40:50(800 bytes)
created at 2017/10/06 15:21:28
The creation time of this html file is 2017/10/06 15:27:09 (Fri Oct 06 15:27:09 2017).